﻿using Kanban.BLLContainer;
using Kanban.IBLL;
using Kanban.Model;
using KanbanApi.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;

namespace KanbanApi.Controllers
{
    public class SIDE_SettingController : BaseController
    {
        private readonly ISIDE_SettingService SIDE_SettingService = Container.Resolve<ISIDE_SettingService>();
        [HttpGet]
        [Route("api/SIDESetting/GetData")]
        public async Task<Table<object>> GetData(string search, int pageSize, int pageIndex)
        {
            var response = await SIDE_SettingService.GetModelsByPageAsync(search, pageSize, pageIndex);
            return new Table<object>(response.Item1, response.Item2);
        }

        [HttpGet]
        [Route("api/SIDESetting/GetModel")]
        public Task<SIDE_Setting> GetModel(int id)
        {
            return SIDE_SettingService.GetModelAsync(id);
        }

        [Route("api/SIDESetting/Remove")]
        public Task<bool> Remove(int id)
        {
            return SIDE_SettingService.DeleteAsync(id);
        }

        [HttpPost]
        [Route("api/SIDESetting/Save")]
        public Task<bool> Save(SIDE_SettingRequest request)
        {
            return SIDE_SettingService.Save(request.Model);
        }
    }
}
